<?php
namespace Ntxx\Controller;
use Think\Controller;
class LoginController extends Controller {
	
	public function index(){
		$this->display();
	}
	
	public function dologin(){
		$use = C('ADMIN');
		$user = I('post.name');
		$pass = I('post.pwd');
		
		if($user == $use['USE'] && $pass = $use['PSW']){
			session('admin',$user);
			define('ADMIN',session('admin'));
			redirect(U('TopicAdmin/index'));
		}
		else{
			$this->assign('msg','用户名或密码不正确！');
			$this->display('index');
			exit();
		}
	}
	
	public function loginout(){
		session('admin',null);
		//cookie('admin_name',null);
		//cookie('admin_pwd',null);
		redirect(U('index'));
	}
}